package com.qfmy.mystation;

import android.app.Application;
import android.os.Environment;

import com.danikula.videocache.HttpProxyCacheServer;
import com.qfmy.mystation.api.APIService;

import org.litepal.LitePal;

/**
 * 描述：Application类
 */
public class MyStationApp extends Application {
    private static MyStationApp context;
    public static HttpProxyCacheServer proxy;

    @Override
    public void onCreate() {
        super.onCreate();
        context = this;
        MyStationInit.initTimber();
        MyStationInit.initOKHttp(this);
        APIService.setHost(context);
        LitePal.initialize(this);
        proxy = newProxy();
    }

    public HttpProxyCacheServer newProxy() {
        return new HttpProxyCacheServer.Builder(this)
                .cacheDirectory(this.getExternalCacheDir())
                .build();
    }

    public static MyStationApp getContext() {
        return context;
    }
}
